using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Timers;
using GuoTao.BLL;

namespace Maticsoft.Web
{
    public partial class Default : System.Web.UI.Page
    {
        
        protected void Page_Load(object sender, EventArgs e)
        {
            top10();
            xiaoshou();
            otherbus();
            djcs();
        }
        public void top10()
        {
            BusInfBLL bll = new BusInfBLL();
            DataSet ds = new DataSet();
            ds = bll.GetList(10, "1=1 order by BusID desc");
            this.BusInfDataList.DataSource = ds;
            this.BusInfDataList.DataBind();
        }
        public void otherbus()
        {
            BusInfBLL bll = new BusInfBLL();
            DataSet ds = new DataSet();
            ds = bll.GetList(12, "BusID not in(select top 10 BusID from BusInf  order by BusID desc) order by BusID desc");
            this.DataList1.DataSource = ds;
            this.DataList1.DataBind();
        }

        public void xiaoshou()
        {
            BusInfBLL bll = new BusInfBLL();
            DataSet ds = new DataSet();
            ds = bll.GetList(10, "1=1 order by xscs desc");
            this.xiaoshouGirdView.DataSource = ds;
            this.xiaoshouGirdView.DataBind();
        }

         public void djcs()
        {
            BusInfBLL bll = new BusInfBLL();
            DataSet ds = new DataSet();
            ds = bll.GetList(15, "1=1 order by djcs desc");
            this.djcsGridView.DataSource = ds;
            this.djcsGridView.DataBind();
        }

        
        public string StrSub(string str, int num)
        {
            //string tempChar;
            //int strlen;
            //strlen=str.Length;
            //For strCount=1 to strlen
            //    tempChar=(mid(mstr,strCount,1))
            //    if Asc(tempChar)>255 or Asc(tempChar)<0 then
            //        chrlen=chrlen+2
            //    else
            //        chrlen=chrlen+1
            //    end if	
            //    if chrlen>strNum*2 then exit for
            //next
            //for (int strCount = 0; strCount < strlen;strCount++)
            //{
            //    tempChar = str.Substring(strCount, 1);
            //    if tempChar.ToString().
            //}
            if (str.Length > num)
            {
                return str.Substring(0, num - 1) + "...";
            }
            else
            {
                return str;
            }
        }
    }
}


